package com.fubowen.reader.ui.download

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.fubowen.reader.adapter.ImportBookViewPagerAdapter
import com.fubowen.reader.databinding.FragmentImportBookBinding
import com.google.android.material.tabs.TabLayout

class ImportBookFragment : Fragment() {

    private lateinit var binding: FragmentImportBookBinding

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
        binding = FragmentImportBookBinding.inflate(inflater)
        initTabLayout()
        return binding.root
    }

    private fun initTabLayout() {
        val viewPager = binding.viewPager
        val adapter = ImportBookViewPagerAdapter(parentFragmentManager)
        viewPager.adapter = adapter
        val tabLayout = binding.tabs
        tabLayout.setupWithViewPager(viewPager)
        viewPager.offscreenPageLimit = 3
    }
}